﻿@inherits AdminCompontentBase

<SAutoComplete Value="Value"
               ValueChanged=UpdateValueAsync
               TItem="RoleSelectDto"
               TValue="List<Guid>"
               TItemValue="Guid"
               Items="Roles"
               Chips
               Multiple
               Disabled=Readonly
               Label="@Label"
               ItemText="t=>t.Name"
               ItemValue="t=>t.Id"
               Class="@Class"
               ItemDisabled="RoleDisabled">
    <SelectionContent Context="data">
        <MChip Close
               Style="height:28px;"
               IsActive="@data.Selected"
               OnCloseClick="()=>RemoveRole(data.Item)">
            <span class="body2 regular--text">
                @data.Item.Name
            </span>
        </MChip>
    </SelectionContent>
    <ItemContent Context="data">
        <MListItemContent>
            <MListItemTitle>
                @if (RoleDisabled(data.Item))
                {
                    <span class="body2 error--text">
                        @($"{data.Item!.Name}-(由于绑定次数限制，无法选择此角色)")
                    </span>
                }
                else
                {
                    <span class="body2 regular--text">
                        @data.Item!.Name
                    </span>
                }
            </MListItemTitle>
        </MListItemContent>
    </ItemContent>
</SAutoComplete>
